//
//  ErroCode.swift
//  Clock
//
//  Created by 方强 on 16/7/1.
//  Copyright © 2016年 MT. All rights reserved.
//

import UIKit

public class ErroCode: NSObject {
    private var code:Int = 0;
    private var msg:String! = "";
    
    public static let CUSTOMCODE = -1;
    
    public init(code:Int!, msg:String!) {
        self.code = code;
        self.msg = msg;
    }
    
    public static let ERROMAP = ["OK":ErroCode(code: 0, msg: "成功"),
        "bleunable": ErroCode(code: 1000, msg: "没有开启蓝牙"),
        "busy": ErroCode(code: 1001, msg: "忙，稍后再试"),
        "timeout": ErroCode(code: 1002, msg: "超时"),
        "macerro": ErroCode(code: 1003, msg: "mac错误"),
        "cantfinddevice": ErroCode(code: 1004, msg: "找不到设备"),
        "scanerro": ErroCode(code: 1005, msg: "扫描错误"),
        "unforturedis": ErroCode(code: 1006, msg: "意外断开"),
        "unconnect": ErroCode(code: 1007, msg: "未连接"),
        "null": ErroCode(code: 1008, msg: "参数为空"),
        "getcharacterro": ErroCode(code: 1009, msg: "未获取到特定特征值"),
        "enablenotifyerro": ErroCode(code: 1010, msg: "使能可通知失败"),
        "disconnect": ErroCode(code: 1011, msg: "未连接"),
        "cancel": ErroCode(code: 1012, msg: "被取消"),
        
        "readuuiderro": ErroCode(code: 1013, msg: "读取uuid失败"),
        "readmajorerro": ErroCode(code: 1014, msg: "读取major失败"),
        "readminorerro": ErroCode(code: 1015, msg: "读取minor失败"),
        "readmeasurederro": ErroCode(code: 1016, msg: "读取measured失败"),
        "readsendpowerderro": ErroCode(code: 1017, msg: "读取发射功率失败"),
        "readsendhzderro": ErroCode(code: 1018, msg: "读取广播频率失败"),
        "readversionderro": ErroCode(code: 1019, msg: "读取版本号失败"),
        
        "setuuiderro": ErroCode(code: 1020, msg: "设置uuid失败"),
        "setmajorerro": ErroCode(code: 1021, msg: "设置major失败"),
        "setminorerro": ErroCode(code: 1022, msg: "设置minor失败"),
        "setmeasurederro": ErroCode(code: 1023, msg: "设置measured失败"),
        "setsendpowerderro": ErroCode(code: 1024, msg: "设置发射功率失败"),
        "setsendhzderro": ErroCode(code: 1025, msg: "设置广播频率失败"),
        "setversionderro": ErroCode(code: 1026, msg: "设置版本号失败"),
        
        "connnectfail": ErroCode(code: 1027, msg: "连接失败"),
        "pwdfail": ErroCode(code: 1028, msg: "密码验证失败"),
        "pwderro": ErroCode(code: 1029, msg: "密码错误"),
        "readpublicparamsfail": ErroCode(code: 1030, msg: "读取公共参数失败"),
        "readprivateparamsfail": ErroCode(code: 1031, msg: "读取私有参数失败"),
        "setpublicparamsfail": ErroCode(code: 1032, msg: "设置公共参数失败"),
        "setprivateparamsfail": ErroCode(code: 1033, msg: "设置私有参数失败"),
        
        "setdevelopfail": ErroCode(code: 1034, msg: "部署失败"),
        
        "discoverservicefail": ErroCode(code: 1035, msg: "发现服务失败"),
        
        "unknow": ErroCode(code: 1, msg: "未知错误")];
    
    public func getCode() -> Int{
        return code;
    }
    public func getMsg() -> String{
        return msg;
    }
    
}
